function isDate(day,month,year){
if( year >2100 || year <1900 )
	return false;
if( month <1 || month >12 )
	return false;
if(!day)
	return false;
var test=new Date(year,month-1,day);
if((1900+test.getYear()==year)&&(month-1==test.getMonth())&&(day==test.getDate()))
	return true;
else if((test.getYear()==year)&&(month-1==test.getMonth())&&(day==test.getDate()))
	return true;
else
	return false;
}

function isEmail(email){l=email.lastIndexOf("@");f=email.indexOf("@");p=email.lastIndexOf(".");if( l!=-1 && l==f && p>l)return false;return true;}

function checkLetter(event) { 	var kc;
	kc=event?event.which:window.event.keyCode; 
    if ( kc<35 || (kc>37 && kc<40) || (kc>41 && kc<48) || (kc>57 && kc<65) ||
 (kc>93 && kc<97) || kc>122 )  { return false; }
	return true;
}

function isUsername(username){
if(username.length<6){alert("Inserisci un nome di almeno 6 caratteri, dai!");return false;}else return true;
}

function isTitle(title){
if(title.length<10){alert("Inserisci un titolo di almeno 10 caratteri, dai!");return false;}else return true;}
function isDescr(descr){
if(descr.length<20){alert("Inserisci una descrizione di almeno 20 caratteri, dai!");return false;}else return true;}

function isPassword(pass1,pass2){
//	static k=0;
//	alert("k:"+k);
//	k++;
	if(pass1.length<6){
		alert("Inserisci una parola segreta di almeno 6 caratteri, dai!");
		return false;
	}
	if(pass2!=null && pass2!=pass1){
		alert("Inserisci la stessa parola segreta in entrambe i box, dai!");
		return false;
	}
	return true;
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function isPositiveInteger (s)
{   var secondArg = false;

   if (isPositiveInteger.arguments.length > 1)
      secondArg = isPositiveInteger.arguments[1];

   // The next line is a bit byzantine.  What it means is:
   // a) s must be a signed integer, AND
   // b) one of the following must be true:
   //    i)  s is empty and we are supposed to return true for
   //        empty strings
   //    ii) this is a positive, not negative, number

   return (isSignedInteger(s, secondArg)
      && ( (isEmpty(s) && secondArg)  || (parseInt (s) > 0) ) );
}

function isSignedInteger (s)
{   if (isEmpty(s))
  if (isSignedInteger.arguments.length == 1) return false;
  else return (isSignedInteger.arguments[1] == true);

  else {
     var startPos = 0;
     var secondArg = false;

     if (isSignedInteger.arguments.length > 1)
        secondArg = isSignedInteger.arguments[1];

     // skip leading + or -
     if ( (s.charAt(0) == "-") || (s.charAt(0) == "+") )
        startPos = 1;
     return (isInteger(s.substring(startPos, s.length), secondArg))
  }
}

function isInteger (s)
{
  var i;

  if (isEmpty(s))
  if (isInteger.arguments.length == 1) return 0;
  else return (isInteger.arguments[1] == true);

  for (i = 0; i < s.length; i++)
  {
     var c = s.charAt(i);

     if (!isDigit(c)) return false;
  }

  return true;
}

function isEmpty(s)
{
  return ((s == null) || (s.length == 0))
}

function isDigit (c)
{
  return ((c >= "0") && (c <= "9"))
}